SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

-- 2012.03.12 EM dbData

create FuNCTION [dbo].[udf_GetAccountSum] (@id int)  
RETURNS money
-- WITH ENCRYPTION 
 AS  
BEGIN 
declare @sum money

if @id is null
	begin
	set @sum=0
	end
else
	select @sum = isnull(a.summary,0) from 	dbData.dbo.Accounts a  
			where 	a.id = @id


RETURN @sum
END
GO
